# this script automaticall download the Macromedia(tm) license, display it, and once confirmed,
# download the necessary SDK files to build the swf plugin for httrack website copier
# this script is GPL
# check binaries
httrack --quiet --help >/dev/null || (echo 'you must first install httrack!' && exit 1)
more /dev/null >/dev/null || (echo 'you must first install more!' && exit 1)
unzip --help >/dev/null || (echo 'you must first install unzip!' && exit 1)
automake --version >/dev/null || (echo 'you must first install automake!' && exit 1)
autoconf --version >/dev/null || (echo 'you must first install autoconf!' && exit 1)
autoheader --help >/dev/null || (echo 'you must first install autoheader!' && exit 1)
# let's go
mkdir -p tmpdownload
cd tmpdownload || (echo "unable to create the temporary directory 'tmpdownload'" && exit 1)
echo "please wait a few moment while downloading the SDK license agreement..."
if httrack --get --quiet --do-not-log --retries 1 http://www.macromedia.com/software/flash/download/search_engine/license2.html < /dev/null >/dev/null; then
if cat license2.html | tr '\t\r\n' ' ' | sed -e 's/<[^<>]*>//g' -e 's/[ ][ ]*/ /g' | sed -e 's/.*\(MACROMEDIA, INC\..*Attention: General Counsel\.\).*/\1/' -e 's/\( [0-9][0-9]*\. \)/#\1/g' | tr '#' '\n' > license2.txt; then
if test -f license2.txt; then
echo
echo
echo
echo
echo "Now you are going to read the MACROMEDIA, INC. Macromedia Flash Search Engine Software Development Kit (SDK) License Agreement"
echo "Press the return key to start reading the license."
read ok
more license2.txt || (echo "unable to display the license agreement" && exit 1)
echo
while true; do
echo "Do you agree with the terms of the license?"
echo "Please enter 'I agree' (without the quotes) if you agree to this Macromedia Flash Search Engine SoftwareDevelopment Kit (SDK) License Agreement "
echo "Just press the return key without typing anything to quit"
read ok
if test "$ok" = "I agree" -o "$ok" = "i agree" -o "$ok" = "I AGREE"; then
echo
echo "ok, installing"
echo "please wait a few moment while downloading the SDK..."
if httrack --quiet --do-not-log --timeout 30 --retries 1 --structure=1003 http://www.macromedia.com/software/flash/download/search_engine/license2.html '-*' '+www.macromedia.com/software/flash/download/search_engine/*.html' '+*.zip'; then
if test -f "flash_search_sdk.zip"; then
echo "unpacking files.."
if unzip -o flash_search_sdk.zip >/dev/null; then
if test -f "swf2html.cpp" -a -f "swf2html.h" -a -f "stags.h"; then
if cp -ax swf2html.cpp swf2html.h ../ && cp -ax stags.h ../swf2htmlstags.h; then
if cp -ax ../Makefile.am.ifswfavailable ../Makefile.am; then
if cd .. && patch -p0<swf2html.patch; then
echo
echo "okay, files are now in place"
echo "you just have to type: (in the main directory)"
echo "automake && autoheader && autoconf"
echo "to regenerate the build system"
echo "and then type in:"
echo "./configure <options..> && make && make install"
echo "to regenerate the configure file and build all files (and the swf module)"
echo ""
echo "example: cd ../.. && automake && autoheader && autoconf && ./configure --prefix=\$HOME && make && make install"
echo
echo "*** process successfull! ***"
exit 0
else
echo "fatal error: unable to patch SDK files"
fi
else
echo "fatal error: unable to replace the Makefile"
fi
else
echo "fatal error: unable to copy SDK files"
fi
else
echo "fatal error: unable to find SDK files"
fi
else
echo "fatal error: unable to unzip SDK"
fi
else
echo "fatal error: unable to find SDK archive"
fi
else
echo "fatal error: unable to download SDK archive"
fi
exit 0
elif test "$ok" = ""; then
exit 0
fi
echo "What did you say?"
done
else
echo "fatal error: error while generating the license file"
fi
else
echo "fatal error: unable to filter the licese"
fi
else
echo "fatal error: unable to download the license file"
fi
echo
echo "an error has occured during the installation process, aborting.."